package com.drug.wms.service.impl;

import com.drug.common.core.domain.entity.SysUser;
import com.drug.common.utils.SecurityUtils;
import com.drug.wms.mapper.BusCommonMapper;
import com.drug.wms.service.IBusCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BusCommonServiceImpl implements IBusCommonService {
    @Autowired
    private BusCommonMapper busCommonMapper;

    @Override
    public List<Map> getSelectByBus(String str) {
        String[] split = str.split(",");
        SysUser user = SecurityUtils.getLoginUser().getUser();
        if (split.length == 3) {
            return busCommonMapper.getSelectByBus(split[0], split[1], split[2], user.getDeptId());
        } else if(split.length==4){
            return busCommonMapper.getSelectByBusAndSql(split[0], split[1], split[2], user.getDeptId(), split[3]);
        }else{
            return null;
        }

    }

    @Override
    public List<Map> getAllShop() {
        return busCommonMapper.getAllShop();
    }
}
